#pragma once
#include"HashBucket.h"
template<class K,class V,class Hash = HashFunc<K>>
class unordered_map
{
	struct MapKeyof
	{
		const K& operator()(const pair<K,V>& kv)
		{
			return kv.first;
		}
	};
public:
	typedef typename HashTable<K, pair<const K, V>, MapKeyof, Hash>::iterator iterator;
	iterator begin()
	{
		return _ht.begin();
	}
	iterator end()
	{
		return _ht.end();
	}
	bool insert(const pair<K, V>& kv)
	{
		return _ht.Insert(kv);
	}
private:
	HashTable<K, pair<const K,V>, MapKeyof, Hash> _ht;
};
void test_map1()
{
	unordered_map<string, string> dict;
	dict.insert(make_pair("sort", ""));
	dict.insert(make_pair("left", ""));
	dict.insert(make_pair("right", "?"));

	for (auto& kv : dict)
	{
		//kv.first += 'x';
		kv.second += 'y';

		cout << kv.first << ":" << kv.second << endl;
	}
}